Skip to content

fix: ignore empty operation_mode to prevent ServiceValidationError#768

Open
songjiao wants to merge 4 commits intowuwentao:masterfrom
songjiao:master
Open

fix: ignore empty operation_mode to prevent ServiceValidationError#768
songjiao wants to merge 4 commits intowuwentao:masterfrom
songjiao:master

Conversation

@songjiao
Copy link

@songjiao songjiao commented Feb 1, 2026

When setting water heater temperature via HA UI, an empty operation_mode parameter may be passed, causing HA core to raise ServiceValidationError before reaching the custom component's validation logic.

This fix adds two layers of protection in MideaCDWaterHeater:

  1. async_handle_set_operation_mode: intercepts before HA core validation
  2. set_operation_mode: additional safety layer for sync calls

PR Description

Reason & Detail

Related issue

fix #X

songjiao and others added 4 commits February 1, 2026 22:35
When setting water heater temperature via HA UI, an empty operation_mode
parameter may be passed, causing HA core to raise ServiceValidationError
before reaching the custom component's validation logic.

This fix adds two layers of protection in MideaCDWaterHeater:
1. async_handle_set_operation_mode: intercepts before HA core validation
2. set_operation_mode: additional safety layer for sync calls

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When setting temperature via automation, the midea-local library includes
current power state in the command message. If power is incorrectly read
as False (due to sync delay or device reporting issues), setting temperature
will turn off the device.

This fix adds a set_temperature override in MideaCDWaterHeater that:
1. Checks current power state before setting temperature
2. Forces power on if device appears to be off
3. Then sets the target temperature

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Without ON_OFF flag, HA blocks water_heater.turn_on service call.
This is needed for automations that detect power-off and auto-restart.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants